<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-demo__hzmember}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.address" placeholder="地址" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-input v-model="dataForm.userName" placeholder="pc账号" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-input v-model="dataForm.appAccount" placeholder="app账号" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-select v-model="dataForm.isActive" :placeholder="$t('hzmember.isActive')" clearable>
            <el-option :label="$t('hzmember.isActive0')" :value="0"></el-option>
            <el-option :label="$t('hzmember.isActive1')" :value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <!--<el-form-item>-->
          <!--<el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>-->
        <!--</el-form-item>-->
        <!--<el-form-item>-->
          <!--<el-button v-if="$hasPermission('hz:member:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>-->
        <!--</el-form-item>-->
        <!--<el-form-item>-->
          <!--<el-button v-if="$hasPermission('hz:member:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>-->
        <!--</el-form-item>-->
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="序号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="userName" label="pc账号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="withdrawNum" label="累计提现" header-align="center" align="center"></el-table-column>
        <el-table-column prop="balance" label="余额" header-align="center" align="center"></el-table-column>
        <el-table-column prop="chargeNum" label="累计充值" header-align="center" align="center"></el-table-column>
        <el-table-column prop="incomeNum" label="累计收益" header-align="center" align="center"></el-table-column>
        <el-table-column prop="consumeNum" label="消费数量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="shareCode" label="邀请码" header-align="center" align="center"></el-table-column>
        <el-table-column prop="appAccount" label="app账号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="address" label="地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="isActive" label="激活状态" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.isActive === 1" size="small">{{ $t('hzmember.isActive1') }}</el-tag>
            <el-tag v-else size="small" type="danger">{{ $t('hzmember.isActive0') }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="activeTime" label="激活时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="isIncome" label="收益状态" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.isIncome === 1" size="small">{{ $t('hzmember.isIncome1') }}</el-tag>
            <el-tag v-else size="small" type="danger">{{ $t('hzmember.isIncome0') }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="incomeTime" label="开启收益时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="incomeCode" label="激活码" header-align="center" align="center"></el-table-column>
        <el-table-column prop="codeTime" label="收益到期时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="hearTime" label="心跳时间" header-align="center" align="center"></el-table-column>

        <!--<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">-->
          <!--<template slot-scope="scope">-->
            <!--<el-button v-if="$hasPermission('hz:member:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>-->
            <!--<el-button v-if="$hasPermission('hz:member:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
          <!--</template>-->
        <!--</el-table-column>-->
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './hzmember-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/hz/member/page',
        getDataListIsPage: true,
        exportURL: '/hz/member/export',
        deleteURL: '/hz/member',
        deleteIsBatch: true
      },
      dataForm: {
        id: '',
        address: '',
        appAccount: '',
        userName: '',
        isActive:null
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
